package cc.customer.web.login;


import cc.customer.authorization.annotation.CurrentUser;
import cc.customer.common.domain.ResponseBo;
import cc.customer.system.domain.MyUser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 接口安全认证的示例controller
 */
@Controller
@RequestMapping("/app/demo")
public class DemoController {

    
   /**
    * Demo 信息，用于POST单个参数获取
    * @param username
    * @param password
    * @return
    */
    @RequestMapping(value = "/getPostParam", method = RequestMethod.GET)
    @ResponseBody
    public ResponseBo getPostParam( @RequestParam String username, @RequestParam String password,@CurrentUser MyUser user) {
        String msg = "操作成功！";
        return ResponseBo.ok(msg,"参数信息1:"+username+"参数信息2："+password+"当前用户信息："+user.getUserId());
    }
    
    /**
     * Demo 信息，用于POST单个参数获取
     * @param username
     * @param password
     * @return
     */
     @RequestMapping(value = "/getPostBean", method = RequestMethod.POST)
     @ResponseBody
     public ResponseBo getPostBean(MyUser myUser,@CurrentUser MyUser user) {
         String msg = "操作成功！";
         return ResponseBo.ok(msg,"参数信息1:"+myUser.getUsername()+"参数信息2："+myUser.getPassword()+"当前用户信息："+user.getUserId());
     }

 
}
